package com.homelock.service;

import com.homelock.entity.HlCommunityAdv;
import com.homelock.entity.HlCommunityAdvExample;
import com.homelock.mapper.HlCommunityAdvMapper;
import com.pi.base.enumerate.record.RecordState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HlCommunityAdvService {
    private static final Logger logger = LoggerFactory.getLogger(HlCommunityAdvService.class);

    @Resource
    HlCommunityAdvMapper hlCommunityAdvMapper;

    public List<HlCommunityAdv> queryListByCommunityId(Long communityId){
        HlCommunityAdvExample example = new HlCommunityAdvExample();
        example.createCriteria().andStateEqualTo(RecordState.STATE_NORMAL.getState()).
                andCommunityIdEqualTo(communityId);
        return hlCommunityAdvMapper.selectByExample(example);
    }


    public List<HlCommunityAdv> queryListByCommunityIds(List<Long> communityIdList){
        HlCommunityAdvExample example = new HlCommunityAdvExample();
        example.createCriteria().andStateEqualTo(RecordState.STATE_NORMAL.getState()).
                andCommunityIdIn(communityIdList);
        return hlCommunityAdvMapper.selectByExample(example);
    }

}
